Advertisement
Guest User

Untitled

a guest
Feb 10th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. t85.c
  2. --
  3.  
  4. #define F_CPU 1000000UL
  5.  
  6. #include <avr/io.h>
  7. #include <util/delay.h>
  8.  
  9.  
  10. void delay_ms(uint16_t count) {
  11. while(count--) {
  12. _delay_ms(1);
  13. }
  14. }
  15.  
  16. int main(void)
  17. {
  18.  
  19. DDRB |= (1<<PB4); /* PORTB output 0b00010000 */
  20.  
  21. while (1)
  22. {
  23. PORTB ^= (1<<PB4);
  24. delay_ms(500);
  25. }
  26. }
  27.  
  28.  
  29.  
  30.  
  31. ######################################
  32.  
  33.  
  34. make output
  35. ---
  36.  
  37. pi@tumor:~/t85 $ make
  38.  
  39. -------- begin --------
  40. avr-gcc (GCC) 4.9.2
  41. Copyright (C) 2014 Free Software Foundation, Inc.
  42. This is free software; see the source for copying conditions. There is NO
  43. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  44.  
  45.  
  46. Compiling C: t85.c
  47. avr-gcc -c -mmcu=attiny85 -I. -gdwarf-2 -DF_CPU=1000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./t85.lst -std=gnu99 -MMD -MP -MF .dep/t85.o.d t85.c -o t85.o
  48.  
  49. Linking: t85.elf
  50. avr-gcc -mmcu=attiny85 -I. -gdwarf-2 -DF_CPU=1000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=t85.o -std=gnu99 -MMD -MP -MF .dep/t85.elf.d t85.o --output t85.elf -Wl,-Map=t85.map,--cref -lm
  51.  
  52. Creating load file for Flash: t85.hex
  53. avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature t85.elf t85.hex
  54.  
  55. Creating load file for EEPROM: t85.eep
  56. avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
  57. --change-section-lma .eeprom=0 --no-change-warnings -O ihex t85.elf t85.eep || exit 0
  58.  
  59. Creating Extended Listing: t85.lss
  60. avr-objdump -h -S -z t85.elf > t85.lss
  61.  
  62. Creating Symbol Table: t85.sym
  63. avr-nm -n t85.elf > t85.sym
  64.  
  65. Size after:
  66. AVR Memory Usage
  67. ----------------
  68. Device: attiny85
  69.  
  70. Program: 92 bytes (1.1% Full)
  71. (.text + .data + .bootloader)
  72.  
  73. Data: 0 bytes (0.0% Full)
  74. (.data + .bss + .noinit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement